package com.jiajia.study.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Title: RabbitMessageListener
 * @Author zjj
 * @Package com.jiajia.study.listener
 * @Date 2024/3/7 10:05
 * @description: rabbit 消息监听
 */

@Component
@Slf4j
public class RabbitMessageListener {

    @RabbitListener(queues = {"direct.queue.a","direct.queue.b"})
    public void receive(Message message){

        byte[] body = message.getBody();
        String msg = new String(body);
        log.info("receive message is : {}",msg);
    }
}
